module Asado (Asado, prenderElFuego, agregar, sacar, sacarN, hay)
where

import Corte

data Asado = Fuego | Agregar Corte Asado deriving Show

prenderElFuego :: Asado
prenderElFuego = Fuego

agregar :: Corte -> Asado -> Asado
agregar c a = (Agregar c a)

hay :: Corte -> Asado -> Bool
hay c (Fuego) = False
hay c (Agregar c1 a) = c == c1 || hay c a

sacar :: Corte -> Asado -> Asado
sacar c (Fuego) = Fuego
sacar c (Agregar c1 a) | c == c1 = sacar c a
                       | otherwise = (Agregar c1 (sacar c a))


-- requiere cantDeCorte(c,a) > n
sacarN :: Int -> Corte -> Asado -> Asado
sacarN 0 c a = a
sacarN n c (Agregar c1 a) | c == c1 = sacarN (n-1) c a
                          | otherwise = (Agregar c1 (sacarN n c a))

